package networks.protocol;

/**
 * 自定义消息
 */
public class Message {

    public MessageType type;
    public String route;
    public byte id;
    public byte[] data;

    public Message(MessageType type, String route, byte id, byte[] data) {
        this.type = type;
        this.route = route;
        this.id = id;
        this.data = data;
    }

    public byte[] Decode() {
        if (data != null && data.length > 0) {
            return data;
        }
        return null;
    }

    // public String Decode() {
    // if (data != null && data.length > 0) {
    // return "";
    // }
    // return null;
    // }
}
